{
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
}
var
	n,i,j,t,a,b:longint;
begin
	a:=0;
	b:=0;
	readln(n);
	for i:=1 to n do
	for j:=1 to n do
	begin
		read(t);
		if(i=j)then a:=a+t;
		if(i+j) =(1+n) then b:=b+t;
	end;
	writeln(a);
	writeln(b);
end.
